package net.wanho.controller;

import lombok.RequiredArgsConstructor;
import net.wanho.service.CaptchaService;
import net.wanho.vo.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Author：汤小洋
 * Date：2024-01-02 16:09
 * Description：<描述>
 */
@RestController
@RequiredArgsConstructor
public class CaptchaController {

    private final CaptchaService captchaService;

    @GetMapping("/captchaImage")
    public AjaxResult captchaImage(){
        Map<String,Object> map = captchaService.captcha();
        return AjaxResult.success(map);
    }

    @GetMapping("/captchaCheck")
    public AjaxResult captchaCheck(String uuid, String code){
        captchaService.check(uuid, code);
        return AjaxResult.success();
    }

}
